package basis.第十四章;


import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

class MyDaemon implements Runnable {

    @Override
    public void run() {
        while (true) {
            System.out.print(Thread.currentThread());
            System.out.println(this);
        }
    }
}

public class Example2128 {
    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 10; i++) {
            Thread thread = new Thread(new MyDaemon());
            thread.setDaemon(true);
            thread.start();
        }

        TimeUnit.MILLISECONDS.sleep(5000);
        System.out.println("shut down");

    }
}
